home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5332 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: prairie.nodak.edu!not-for-mail
  2. From: wstark@prairie.nodak.edu (Just Me)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: RETURN ();
  5. Date: 9 Feb 1996 23:47:34 -0600
  6. Organization: North Dakota Higher Education Computing Network (NDHECN)
  7. Message-ID: <4fhbhm$c8g@prairie.nodak.edu>
  8. References: <DMFxxq.7M7@emi.net> <4fc6ve$kbn@s02.pavilion.co.uk>
  9. NNTP-Posting-Host: prairie.nodak.edu
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=US-ASCII
  12. Content-Transfer-Encoding: 7bit
  13.  
  14. In article <4fc6ve$kbn@s02.pavilion.co.uk>,
  15. Andy J Robb <AJRobb@pavilion.co.uk> wrote:
  16. >main(int, char**)    /* This says "ignore the command line" */
  17.  
  18. This may be a valid prototype, but it is NOT a valid definition.  There
  19. is absolutely nothing wrong with:
  20.  
  21.     int main(void)
  22.  
  23. and it means exactly what you intend:
  24.  
  25.     int main(int, char **)
  26.  
  27. to mean, but also has the feature of actually working.
  28.  
  29. >#include <stdio.h>
  30.  
  31. >void Input_data(int *x, int *y, int *z)
  32. >{ 
  33. >  *x = 5;
  34. >  *y = 30;
  35. >  *z = 10;
  36. >}
  37.  
  38. >main(int, char**)
  39. >{ int x, y, z;
  40. >  Input_data(&x, &y, &z);
  41.  
  42. >  printf("here are the data: x=\"%d\", y=\"%d\", z=\"%d\"\n", x,y,z);
  43.  
  44. >  return 0;
  45. >}
  46.  
  47. Did you actually try to compile this before posting?  I could not find one
  48. single compiler that would accept your version of main().  It does work
  49. as intended, if you change your definition of main() to : main(void), 
  50. main(int argc, char **argv), or just main().
  51.  
  52. --
  53.     wstark@prairie.nodak.edu
  54. ***************************************************************************
  55. If they don't keep on exercising their lips, their brains start working.
  56.  -- Ford Prefect's theory on humans, Hitchhikers Guide to the Galaxy.
  57. ***************************************************************************
  58.